home *** CD-ROM | disk | FTP | other *** search
/ Leonardo the Inventor / Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso / LEOWINMV / DATABASE.DIR / 00096_Script_PICTURES < prev    next >
Text File  |  1996-03-28  |  5KB  |  155 lines

  1. -- --------------------------------------------------------------
  2. -- Handler showTopicPicture
  3.  
  4. on showTopicPicture
  5.   global textSprite, clickedTopic, pictureSprite, pictureR, pictureT,pictureB, pictureL
  6.   global currentPicture
  7.   
  8.   set pictureCast = getPictureCastNumber(clickedTopic, currentPicture)
  9.   if (pictureCast = -1) then -- no picture
  10.     errorAlert("No picture for" && clickedTopic)
  11.     exit
  12.   end if
  13.   
  14.   -- empty the text
  15.   set the castNum of sprite textSprite = the number of cast "Empty Text"
  16.   
  17.   -- show the picture
  18.   set the castNum of sprite pictureSprite = the number of cast pictureCast
  19.   
  20.   global pictureH, pictureV
  21.   set the locH of sprite pictureSprite = pictureH
  22.   set the locV of sprite pictureSprite = pictureV
  23.   -- is the following needed? it was already commented out
  24.   -- spriteBox pictureSprite,pictureL,pictureT,pictureR,pictureB
  25.   showTopicPictureCaption
  26.   
  27.   showMoreButtons
  28.   -- is the following needed? it was already commented out
  29.   --  setClearedFlag(False)
  30.   updateStage
  31. end
  32.  
  33. -- --------------------------------------------------------------
  34. -- Handler removeTopicPicture
  35.  
  36. on removeTopicPicture
  37.   global pictureSprite
  38.   
  39.   removeFromStage(pictureSprite)
  40.   removeTopicPictureCaption
  41.   addLine
  42. end
  43.  
  44. -- --------------------------------------------------------------
  45. -- Handler renamePictures
  46.  
  47. on renamePictures startCast,numPictures
  48.   repeat with i = 1 to numPictures 
  49.     set PictureNamesInfo = the text of cast "PictureNames"
  50.     set NamePicture = line i of PictureNamesInfo
  51.     set the name of cast (startCast + i - 1) = NamePicture && "PICTURE"
  52.   end repeat
  53. end
  54.  
  55. -- --------------------------------------------------------------
  56. -- Handler isPictureTitle returns TRUE if the given title is
  57. -- the title of a picture and FALSE otherwise.
  58.  
  59. on isPictureTitle whichTitle
  60.   global pictureTitles
  61.   
  62.   return pictureTitles contains whichTitle & RETURN
  63. end
  64.  
  65. -- --------------------------------------------------------------
  66. -- Handler resetCurrentPicture resets the global variable currentPicture
  67. -- to 1. This global variable is used to indicate the picture number
  68. -- of the currently displayed topic (to know what picture
  69. -- number the previous and next pictures are for moreUp and moreDown).
  70.  
  71. on resetCurrentPicture
  72.   global currentPicture
  73.   
  74.   set currentPicture = 1
  75. end
  76.  
  77. -- --------------------------------------------------------------
  78. -- Handler updateCurrentPicture sets the global variable currentPicture
  79. -- to the next picture in the given direction.
  80.  
  81. on updateCurrentPicture direction
  82.   global currentPicture
  83.   
  84.   set currentPicture = currentPicture + direction
  85. end
  86.  
  87. -- --------------------------------------------------------------
  88. -- Handler setCurrentPicture sets the global variable currentPicture
  89. -- to the picture number of the current topic picture.
  90.  
  91. on setCurrentPicture -- called from ???
  92.   global currentPicture, pictureSprite
  93.   
  94.   set currentPicture = value(the last char of the name of cast the castNum of sprite pictureSprite)
  95. end
  96.  
  97. -- --------------------------------------------------------------
  98. -- Handler showPrevPicture activates the more up button and then
  99. -- calls showMorePicture to show the previous picture and caption.
  100.  
  101. on showPrevPicture
  102.   global pageUpButton
  103.   
  104.   if isEnabled(pageUpButton) then
  105.     activateButtonThenEnable(pageUpButton)
  106.     showMorePicture(-1)
  107.   end if
  108. end
  109.  
  110. -- --------------------------------------------------------------
  111. -- Handler showNextPicture activates the more down button and then
  112. -- calls showMorePicture to show the next picture and caption.
  113.  
  114. on showNextPicture
  115.   global pageDownButton
  116.   
  117.   if isEnabled(pageDownButton) then
  118.     activateButtonThenEnable(pageDownButton)
  119.     showMorePicture(1)
  120.   end if
  121. end
  122.  
  123. -- --------------------------------------------------------------
  124. -- Handler showMorePicture shows the next page of the text in the given
  125. -- direction.
  126.  
  127. on showMorePicture direction
  128.   global pictureSprite
  129.   
  130.   set nextPictureCastNumber = getNextPictureCast(direction)
  131.   set the castNum of sprite pictureSprite = nextPictureCastNumber
  132.   
  133.   updateCurrentPicture(direction)
  134.   updateCurrentCaption(direction)
  135.   showTopicPictureCaption
  136.   showMoreButtons
  137.   updateStage
  138. end
  139.  
  140. -- --------------------------------------------------------------
  141. -- Handler getNextPictureCast returns the cast number of the next picture
  142. -- if the current topic has more pictures and -1 otherwise.
  143.  
  144. on getNextPictureCast direction
  145.   global pictureSprite, currentPicture
  146.   
  147.   waitCursor
  148.   
  149.   set castNumber = getPictureCastNumber(clickedTopic, currentPicture + direction)
  150.   normalCursor
  151.   
  152.   return castNumber
  153. end
  154.  
  155.